using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;
using System.Collections;
namespace BLT
{
    public class HUD {

        #region Fields
        /// <summary>
        /// Holds the information overlays to be used in the HUD
        /// </summary>      
        private Dictionary<String, InformationOverlay> informationOverlays = 
            new Dictionary<String, InformationOverlay>();
        #endregion

        #region Constructors
        public HUD() {

        }
        public HUD(Dictionary<String, InformationOverlay> informationOverlays) {
            this.informationOverlays = informationOverlays;
        }
        #endregion

        #region Other Functions
        /// <summary>
        /// Adds an information overlay to the HUD
        /// </summary>
        /// <param name="name">The name corresponding to this information overlay</param>
        /// <param name="overlay">The information overlay</param>
        public void AddInformationOverlay(String name, InformationOverlay overlay) {
            this.informationOverlays.Add(name, overlay);
        }

        /// <summary>
        /// Removes an information overlay from the HUD
        /// </summary>
        /// <param name="name">The name of the information overlay to remove</param>
        public void RemoveInformationOverlay(String name) {
            this.informationOverlays.Remove(name);
        }

        /// <summary>
        /// Gets an information overlay from the HUD
        /// </summary>
        /// <param name="name">The name of the information overlay to return</param>
        /// <returns>NULL if the information overlay of the given name does not exist, 
        /// or the information overlay specified</returns>
        public InformationOverlay GetInformationOverlay(String name) {
            if (informationOverlays.ContainsKey(name))
            {
                return informationOverlays[name];
            }
            return null;
        }

        /// <summary>
        /// Modifies an information overlay from the HUD
        /// </summary>
        /// <param name="name">The name of the information overlay to modify</param>
        /// <param name="information">The hashtable of information</param>
        /// <returns>NULL if the information overlay of the given name does not exist, 
        /// or the information overlay specified</returns>
        public void ModifyInformationOverlay(String name, List<KeyValuePair<string, string>> information)
        {
            this.informationOverlays[name].m_information = information;
        }

        /// <summary>
        /// Draws the HUD (by drawing all of its constituent information overlays
        /// </summary>
        public void Draw(SpriteBatch sb) {
            foreach (InformationOverlay io in informationOverlays.Values)
            {
                io.Draw(sb);
            }
        }
        #endregion
    }

    
}
